package com.fzshang.shopping.api.controller;


import com.fzshang.shopping.commen.bean.Feedback;
import com.fzshang.shopping.commen.bean.Sale;
import com.fzshang.shopping.commen.bean.layuiBean.ResultPage;
import com.fzshang.shopping.commen.bean.layuiBean.VoPage;
import com.fzshang.shopping.commen.controller.BaseController;
import com.fzshang.shopping.commen.entity.ApiResult;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * <p>
 * 建议反馈 前端控制器
 * </p>
 *
 * @author 冯政尚
 * @since 2020-03-12
 */
@Controller
@RequestMapping("admin/feedback")
public class FeedbackController extends BaseController {

    @RequestMapping(value = "feedback.html")
    public String feedback(){
        return "admin/feedback/feedback";
    }

    /**
     * @param voPage
     * @return 后台查询
     */
    @RequestMapping(value = "selectMyPage",method = RequestMethod.GET)
    @ResponseBody
    public ResultPage<Feedback> selectMyPage(VoPage voPage, Feedback feedback){
        return feedbackService.selectMyPage(voPage,feedback);
    }

    /**
     * @param
     * @return 解决
     */
    @RequestMapping(value = "success")
    @ResponseBody
    public ApiResult save(Long id){
        Feedback feedback = feedbackService.getById(id);
        feedback.setState(1);
        if(feedbackService.updateById(feedback)){
            return ApiResult.ok();
        }
        return ApiResult.fail();
    }




}
